package com.spring.demo11.eg1;

import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ResourceBundleMessageSource;

/**
 * @author vhans
 */
@Configuration
public class MainConfig2 {
    @Bean
    public MessageSource messageSource() {
        ResourceBundleMessageSource result = new ResourceBundleMessageSource();
        result.setBasenames("config/demo11/message");
        result.setDefaultEncoding("UTF-8");
        // 设置缓存时间为1000ms
        result.setCacheMillis(1000);
        return result;
    }
}
